import 'package:p_location/map/res/search_person_detail.dart';

class SearchPersonInfo {
  List<SearchPersonDetail> employeeList; //内部员工
  List<SearchPersonDetail> guestList; //外来访客
  List<SearchPersonDetail> workerList; //承包商
  List<SearchPersonDetail> innerCarList; //内部车辆
  List<SearchPersonDetail> outerCarList; //外来车辆

  SearchPersonInfo(
      {this.employeeList,
      this.guestList,
      this.workerList,
      this.innerCarList,
      this.outerCarList});

  factory SearchPersonInfo.fromJson(Map<String, dynamic> json) {
    return SearchPersonInfo(
      employeeList: json['内部员工'] != null
          ? (json['内部员工'] as List)
              .map((i) => SearchPersonDetail.fromJson(i, '内部员工'))
              .toList()
          : null,
      guestList: json['外来访客'] != null
          ? (json['外来访客'] as List)
              .map((i) => SearchPersonDetail.fromJson(i, '外来访客'))
              .toList()
          : null,
      workerList: json['承包商'] != null
          ? (json['承包商'] as List)
              .map((i) => SearchPersonDetail.fromJson(i, '承包商'))
              .toList()
          : null,
      innerCarList: json['内部车辆'] != null
          ? (json['内部车辆'] as List)
              .map((i) => SearchPersonDetail.fromJson(i, '内部车辆'))
              .toList()
          : null,
      outerCarList: json['外来车辆'] != null
          ? (json['外来车辆'] as List)
              .map((i) => SearchPersonDetail.fromJson(i, '外来车辆'))
              .toList()
          : null,
    );
  }

//    Map<String, dynamic> toJson() {
//        final Map<String, dynamic> data = new Map<String, dynamic>();
//        if (this.内部员工 != null) {
//            data['内部员工'] = this.内部员工.map((v) => v.toJson()).toList();
//        }
//        if (this.外来访客 != null) {
//            data['外来访客'] = this.外来访客.map((v) => v.toJson()).toList();
//        }
//        if (this.承包商 != null) {
//            data['承包商'] = this.承包商.map((v) => v.toJson()).toList();
//        }
//        return data;
//    }
}
